home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / khtml_part.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-07-22  |  46.2 KB  |  1,684 lines

  1. // -*- c-basic-offset: 2 -*-
  2. /* This file is part of the KDE project
  3.  *
  4.  * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
  5.  *                     1999-2001 Lars Knoll <knoll@kde.org>
  6.  *                     1999-2001 Antti Koivisto <koivisto@kde.org>
  7.  *                     2000-2001 Simon Hausmann <hausmann@kde.org>
  8.  *                     2000-2001 Dirk Mueller <mueller@kde.org>
  9.  *                     2000 Stefan Schimanski <1Stein@gmx.de>
  10.  *
  11.  * This library is free software; you can redistribute it and/or
  12.  * modify it under the terms of the GNU Library General Public
  13.  * License as published by the Free Software Foundation; either
  14.  * version 2 of the License, or (at your option) any later version.
  15.  *
  16.  * This library is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  19.  * Library General Public License for more details.
  20.  *
  21.  * You should have received a copy of the GNU Library General Public License
  22.  * along with this library; see the file COPYING.LIB.  If not, write to
  23.  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  24.  * Boston, MA 02110-1301, USA.
  25.  */
  26. #ifndef __khtml_part_h__
  27. #define __khtml_part_h__
  28.  
  29. #include "dom/html_document.h"
  30. #include "dom/dom2_range.h"
  31.  
  32. #include <kparts/part.h>
  33. #include <kparts/browserextension.h>
  34. #include <kdemacros.h>
  35. #include <kfinddialog.h>
  36.  
  37. #include <qregexp.h>
  38.  
  39. class KHTMLPartPrivate;
  40. class KHTMLPartBrowserExtension;
  41. class KJSProxy;
  42. class KHTMLView;
  43. class KHTMLSettings;
  44. class KJavaAppletContext;
  45. class KJSErrorDlg;
  46.  
  47. namespace DOM
  48. {
  49.   class HTMLDocument;
  50.   class HTMLDocumentImpl;
  51.   class DocumentImpl;
  52.   class HTMLTitleElementImpl;
  53.   class HTMLElementImpl;
  54.   class HTMLFrameElementImpl;
  55.   class HTMLIFrameElementImpl;
  56.   class HTMLObjectElementImpl;
  57.   class HTMLFormElementImpl;
  58.   class HTMLAnchorElementImpl;
  59.   class HTMLMetaElementImpl;
  60.   class NodeImpl;
  61.   class Node;
  62.   class HTMLEventListener;
  63.   class EventListener;
  64. }
  65.  
  66. namespace KJS
  67. {
  68.   class Interpreter;
  69. }
  70.  
  71. namespace khtml
  72. {
  73.   class DocLoader;
  74.   class RenderPart;
  75.   class RenderPartObject;
  76.   class ChildFrame;
  77.   class MouseEvent;
  78.   class MousePressEvent;
  79.   class MouseDoubleClickEvent;
  80.   class MouseMoveEvent;
  81.   class MouseReleaseEvent;
  82.   class DrawContentsEvent;
  83.   class CachedObject;
  84.   class RenderWidget;
  85.   class CSSStyleSelector;
  86.   class HTMLTokenizer;
  87.   class Decoder;
  88.   class XMLTokenizer;
  89. }
  90.  
  91. namespace KJS {
  92.     class Window;
  93.     class WindowFunc;
  94.     class ExternalFunc;
  95.     class JSEventListener;
  96.     class JSLazyEventListener;
  97.     class JSNodeFilter;
  98.     class DOMDocument;
  99.     class SourceFile;
  100.     class ScheduledAction;
  101. }
  102.  
  103. namespace KParts
  104. {
  105.   class PartManager;
  106.   class LiveConnectExtension;
  107. }
  108.  
  109. namespace KWallet
  110. {
  111.   class Wallet;
  112. }
  113.  
  114. /**
  115.  * This class is khtml's main class. It features an almost complete
  116.  * web browser, and html renderer.
  117.  *
  118.  * The easiest way to use this class (if you just want to display an HTML
  119.  * page at some URL) is the following:
  120.  *
  121.  * \code
  122.  * KURL url = "http://www.kde.org";
  123.  * KHTMLPart *w = new KHTMLPart();
  124.  * w->openURL(url);
  125.  * w->view()->resize(500, 400);
  126.  * w->show();
  127.  * \endcode
  128.  *
  129.  * Java and JavaScript are enabled by default depending on the user's
  130.  * settings. If you do not need them, and especially if you display
  131.  * unfiltered data from untrusted sources, it is strongly recommended to
  132.  * turn them off. In that case, you should also turn off the automatic
  133.  * redirect and plugins:
  134.  *
  135.  * \code
  136.  * w->setJScriptEnabled(false);
  137.  * w->setJavaEnabled(false);
  138.  * w->setMetaRefreshEnabled(false);
  139.  * w->setPluginsEnabled(false);
  140.  * \endcode
  141.  *
  142.  * You may also wish to disable external references.  This will prevent KHTML
  143.  * from loading images, frames, etc,  or redirecting to external sites.
  144.  *
  145.  * \code
  146.  * w->setOnlyLocalReferences(true);
  147.  * \endcode
  148.  *
  149.  * Some apps want to write their HTML code directly into the widget instead of
  150.  * opening an url. You can do this in the following way:
  151.  *
  152.  * \code
  153.  * QString myHTMLCode = ...;
  154.  * KHTMLPart *w = new KHTMLPart();
  155.  * w->begin();
  156.  * w->write(myHTMLCode);
  157.  * ...
  158.  * w->end();
  159.  * \endcode
  160.  *
  161.  * You can do as many calls to write() as you wish.  There are two
  162.  * write() methods, one accepting a QString and one accepting a
  163.  * @p char @p * argument. You should use one or the other
  164.  * (but not both) since the method using
  165.  * the @p char @p * argument does an additional decoding step to convert the
  166.  * written data to Unicode.
  167.  *
  168.  * It is also possible to write content to the HTML part using the
  169.  * standard streaming API from KParts::ReadOnlyPart. The usage of
  170.  * the API is similar to that of the begin(), write(), end() process
  171.  * described above as the following example shows:
  172.  *
  173.  * \code
  174.  * KHTMLPart *doc = new KHTMLPart();
  175.  * doc->openStream( "text/html", KURL() );
  176.  * doc->writeStream( QCString( "<html><body><p>KHTML Rocks!</p></body></html>" ) );
  177.  * doc->closeStream();
  178.  * \endcode
  179.  *
  180.  * @short HTML Browser Widget
  181.  * @author Lars Knoll (knoll@kde.org)
  182.  *
  183.  */
  184. class KHTML_EXPORT KHTMLPart : public KParts::ReadOnlyPart
  185. {
  186.   Q_OBJECT
  187.   friend class KHTMLView;
  188.   friend class DOM::HTMLTitleElementImpl;
  189.   friend class DOM::HTMLFrameElementImpl;
  190.   friend class DOM::HTMLIFrameElementImpl;
  191.   friend class DOM::HTMLObjectElementImpl;
  192.   friend class DOM::HTMLAnchorElementImpl;
  193.   friend class DOM::HTMLMetaElementImpl;
  194.   friend class DOM::NodeImpl;
  195.   friend class KHTMLRun;
  196.   friend class DOM::HTMLFormElementImpl;
  197.   friend class khtml::RenderPartObject;
  198.   friend class KJS::Window;
  199.   friend class KJS::ScheduledAction;
  200.   friend class KJS::JSNodeFilter;
  201.   friend class KJS::WindowFunc;
  202.   friend class KJS::ExternalFunc;
  203.   friend class KJS::JSEventListener;
  204.   friend class KJS::JSLazyEventListener;
  205.   friend class KJS::DOMDocument;
  206.   friend class KJS::SourceFile;
  207.   friend class KJSProxy;
  208.   friend class KHTMLPartBrowserExtension;
  209.   friend class DOM::DocumentImpl;
  210.   friend class DOM::HTMLDocumentImpl;
  211.   friend class KHTMLPartBrowserHostExtension;
  212.   friend class khtml::HTMLTokenizer;
  213.   friend class khtml::XMLTokenizer;
  214.   friend class khtml::RenderWidget;
  215.   friend class khtml::CSSStyleSelector;
  216.   friend class KHTMLPartIface;
  217.   friend class KHTMLPartFunction;
  218.   friend class KHTMLPopupGUIClient;
  219.  
  220.   Q_PROPERTY( bool javaScriptEnabled READ jScriptEnabled WRITE setJScriptEnabled )
  221.   Q_PROPERTY( bool javaEnabled READ javaEnabled WRITE setJavaEnabled )
  222.   Q_PROPERTY( bool autoloadImages READ autoloadImages WRITE setAutoloadImages )
  223.   Q_PROPERTY( bool dndEnabled READ dndEnabled WRITE setDNDEnabled )
  224.   Q_PROPERTY( bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled )
  225.  
  226.   /*
  227.    *
  228.    * Don't add setOnlyLocalReferences here. It shouldn't be accessible via DCOP.
  229.    *
  230.    **/
  231.   Q_PROPERTY( QCString dcopObjectId READ dcopObjectId )
  232.   Q_PROPERTY( bool modified READ isModified )
  233.  
  234. public:
  235.   enum GUIProfile { DefaultGUI, BrowserViewGUI /* ... */ };
  236.  
  237.   /**
  238.    * Constructs a new KHTMLPart.
  239.    *
  240.    * KHTML basically consists of two objects: The KHTMLPart itself,
  241.    * holding the document data (DOM document), and the KHTMLView,
  242.    * derived from QScrollView, in which the document content is
  243.    * rendered in. You can specify two different parent objects for a
  244.    * KHTMLPart, one parent for the KHTMLPart document and on parent
  245.    * for the KHTMLView. If the second @p parent argument is 0L, then
  246.    * @p parentWidget is used as parent for both objects, the part and
  247.    * the view.
  248.    */
  249.   KHTMLPart( QWidget *parentWidget = 0, const char *widgetname = 0,
  250.              QObject *parent = 0, const char *name = 0, GUIProfile prof = DefaultGUI );
  251.  
  252.   KHTMLPart( KHTMLView *view, QObject *parent = 0, const char *name = 0, GUIProfile prof = DefaultGUI );
  253.  
  254.   /**
  255.    * Destructor.
  256.    */
  257.   virtual ~KHTMLPart();
  258.  
  259.   /**
  260.    * Opens the specified URL @p url.
  261.    *
  262.    * Reimplemented from KParts::ReadOnlyPart::openURL .
  263.    */
  264.   virtual bool openURL( const KURL &url );
  265.  
  266.   /**
  267.    * Stops loading the document and kills all data requests (for images, etc.)
  268.    */
  269.   virtual bool closeURL();
  270.  
  271.   /**
  272.    * Called when a certain error situation (i.e. connection timed out) occurred.
  273.    * The default implementation either shows a KIO error dialog or loads a more
  274.    * verbose error description a as page, depending on the users configuration.
  275.    * @p job is the job that signaled the error situation
  276.    */
  277.   virtual void showError( KIO::Job* job );
  278.  
  279.   /**
  280.    * Returns a reference to the DOM HTML document (for non-HTML documents, returns null)
  281.    */
  282.   DOM::HTMLDocument htmlDocument() const;
  283.  
  284.   /**
  285.    * Returns a reference to the DOM document.
  286.    */
  287.   DOM::Document document() const;
  288.  
  289.   /**
  290.    * Returns the content of the source document.
  291.    * @since 3.4
  292.    */
  293.    QString documentSource() const;
  294.  
  295.   /**
  296.    * Returns the node that has the keyboard focus.
  297.    */
  298.   DOM::Node activeNode() const;
  299.  
  300.   /**
  301.    * Returns a pointer to the KParts::BrowserExtension.
  302.    */
  303.   KParts::BrowserExtension *browserExtension() const;
  304.   KParts::LiveConnectExtension *liveConnectExtension( const khtml::RenderPart *) const;
  305.   KParts::BrowserHostExtension *browserHostExtension() const;
  306.  
  307.   /**
  308.    * Returns a pointer to the HTML document's view.
  309.    */
  310.   KHTMLView *view() const;
  311.  
  312.   /**
  313.    * Enable/disable Javascript support. Note that this will
  314.    * in either case permanently override the default usersetting.
  315.    * If you want to have the default UserSettings, don't call this
  316.    * method.
  317.    */
  318.   void setJScriptEnabled( bool enable );
  319.  
  320.   /**
  321.    * Returns @p true if Javascript support is enabled or @p false
  322.    * otherwise.
  323.    */
  324.   bool jScriptEnabled() const;
  325.  
  326.   /**
  327.    * Returns the JavaScript interpreter the part is using. This method is
  328.    * mainly intended for applications which embed and extend the part and
  329.    * provides a mechanism for adding additional native objects to the
  330.    * interpreter (or removing the built-ins).
  331.    *
  332.    * One thing people using this method to add things to the interpreter must
  333.    * consider, is that when you start writing new content to the part, the
  334.    * interpreter is cleared. This includes both use of the
  335.    * begin( const KURL &, int, int ) method, and the openURL( const KURL & )
  336.    * method. If you want your objects to have a longer lifespan, then you must
  337.    * retain a KJS::Object yourself to ensure that the reference count of your
  338.    * custom objects never reaches 0. You will also need to re-add your
  339.    * bindings everytime this happens - one way to detect the need for this is
  340.    * to connect to the docCreated() signal, another is to reimplement the
  341.    * begin() method.
  342.    */
  343.   KJS::Interpreter *jScriptInterpreter();
  344.  
  345.   /**
  346.    * Enable/disable statusbar messages.
  347.    * When this class wants to set the statusbar text, it emits
  348.    * setStatusBarText(const QString & text)
  349.    * If you want to catch this for your own statusbar, note that it returns
  350.    * back a rich text string, starting with "<qt>".  This you need to
  351.    * either pass this into your own QLabel or to strip out the tags
  352.    * before passing it to QStatusBar::message(const QString & message)
  353.    *
  354.    * @see KParts::Part::setStatusBarText( const QString & text )
  355.    */
  356.   void setStatusMessagesEnabled( bool enable );
  357.  
  358.   /**
  359.    * Returns @p true if status messages are enabled.
  360.    */
  361.   bool statusMessagesEnabled() const;
  362.  
  363.   /**
  364.    * Enable/disable automatic forwarding by <meta http-equiv="refresh" ....>
  365.    */
  366.   void setMetaRefreshEnabled( bool enable );
  367.  
  368.   /**
  369.    * Returns @p true if automatic forwarding is enabled.
  370.    */
  371.   bool metaRefreshEnabled() const;
  372.  
  373.   /**
  374.    * Same as executeScript( const QString & ) except with the Node parameter
  375.    * specifying the 'this' value.
  376.    */
  377.   QVariant executeScript( const DOM::Node &n, const QString &script );
  378.  
  379.   /**
  380.    * Enables or disables Drag'n'Drop support. A drag operation is started if
  381.    * the users drags a link.
  382.    */
  383.   void setDNDEnabled( bool b );
  384.  
  385.   /**
  386.    * Returns whether Dragn'n'Drop support is enabled or not.
  387.    */
  388.   bool dndEnabled() const;
  389.  
  390.   /**
  391.    * Enables/disables Java applet support. Note that calling this function
  392.    * will permanently override the User settings about Java applet support.
  393.    * Not calling this function is the only way to let the default settings
  394.    * apply.
  395.    */
  396.   void setJavaEnabled( bool enable );
  397.  
  398.   /**
  399.    * Return true if Java applet support is enabled, false if disabled
  400.    */
  401.   bool javaEnabled() const;
  402.  
  403.   /**
  404.    * Returns the java context of the applets. If no applet exists, 0 is returned.
  405.    */
  406.   KJavaAppletContext *javaContext();
  407.  
  408.   /**
  409.    * Returns the java context of the applets. If no context exists yet, a
  410.    * new one is created.
  411.    */
  412.   KJavaAppletContext *createJavaContext();
  413.  
  414.   /**
  415.    * Enables or disables plugins, default is enabled
  416.    */
  417.   void setPluginsEnabled( bool enable );
  418.  
  419.   /**
  420.    * Returns true if plugins are enabled/disabled.
  421.    */
  422.   bool pluginsEnabled() const;
  423.  
  424.   /**
  425.    * Specifies whether images contained in the document should be loaded
  426.    * automatically or not.
  427.    *
  428.    * @note Request will be ignored if called before begin().
  429.    */
  430.   void setAutoloadImages( bool enable );
  431.   /**
  432.    * Returns whether images contained in the document are loaded automatically
  433.    * or not.
  434.    * @note that the returned information is unrelieable as long as no begin()
  435.    * was called.
  436.    */
  437.   bool autoloadImages() const;
  438.  
  439.   /**
  440.    * Security option.
  441.    *
  442.    * Specify whether only file:/ or data:/ urls are allowed to be loaded without
  443.    * user confirmation by KHTML.
  444.    * ( for example referenced by stylesheets, images, scripts, subdocuments, embedded elements ).
  445.    *
  446.    * This option is mainly intended for enabling the "mail reader mode", where you load untrusted
  447.    * content with a file:/ url.
  448.    *
  449.    * Please note that enabling this option currently automatically disables Javascript,
  450.    * Java and Plugins support. This might change in the future if the security model
  451.    * is becoming more sophisticated, so don't rely on this behaviour.
  452.    *
  453.    * ( default false - everything is loaded unless forbidden by KApplication::authorizeURLAction).
  454.    */
  455.   void setOnlyLocalReferences( bool enable );
  456.  
  457.   /**
  458.    * Returns whether only file:/ or data:/ references are allowed
  459.    * to be loaded ( default false ).  See setOnlyLocalReferences.
  460.    **/
  461.   bool onlyLocalReferences() const;
  462.  
  463.   /** Returns whether caret mode is on/off.
  464.    * @since 3.2
  465.    */
  466.   bool isCaretMode() const;
  467.  
  468.   /**
  469.    * Returns @p true if the document is editable, @p false otherwise.
  470.    * @since 3.2
  471.    */
  472.   bool isEditable() const;
  473.  
  474.   /**
  475.    * Sets the caret to the given position.
  476.    *
  477.    * If the given location is invalid, it will snap to the nearest valid
  478.    * location. Immediately afterwards a @p caretPositionChanged signal
  479.    * containing the effective position is emitted
  480.    * @param node node to set to
  481.    * @param offset zero-based offset within the node
  482.    * @param extendSelection If @p true, a selection will be spanned from the
  483.    *    last caret position to the given one. Otherwise, any existing selection
  484.    *    will be deselected.
  485.    * @since 3.2
  486.    */
  487.   void setCaretPosition(DOM::Node node, long offset, bool extendSelection = false);
  488.  
  489.   /**
  490.    * Enumeration for displaying the caret.
  491.    * @param Visible caret is displayed
  492.    * @param Invisible caret is not displayed
  493.    * @param Blink caret toggles between visible and invisible
  494.    * @since 3.2
  495.    */
  496.   enum CaretDisplayPolicy {
  497.     CaretVisible, CaretInvisible, CaretBlink
  498.   };
  499.  
  500.   /**
  501.    * Returns the current caret policy when the view is not focused.
  502.    * @since 3.2
  503.    */
  504.   CaretDisplayPolicy caretDisplayPolicyNonFocused() const;
  505.  
  506.   /**
  507.    * Sets the caret display policy when the view is not focused.
  508.    *
  509.    * Whenever the caret is in use, this property determines how the
  510.    * caret should be displayed when the document view is not focused.
  511.    *
  512.    * The default policy is CaretInvisible.
  513.    * @param policy new display policy
  514.    * @since 3.2
  515.    */
  516.   void setCaretDisplayPolicyNonFocused(CaretDisplayPolicy policy);
  517.  
  518. #ifndef KDE_NO_COMPAT
  519.   void enableJScript( bool e ) { setJScriptEnabled(e); }
  520.   void enableJava( bool e ) { setJavaEnabled(e); }
  521.   void enablePlugins( bool e ) { setPluginsEnabled(e); }
  522.   void autoloadImages( bool e ) { setAutoloadImages(e); }
  523.   void enableMetaRefresh( bool e ) { setMetaRefreshEnabled(e); }
  524.   bool setCharset( const QString &, bool ) { return true; }
  525.  
  526.   KURL baseURL() const;
  527.   QString baseTarget() const;
  528. #endif
  529.  
  530.   /**
  531.    * Returns the URL for the background Image (used by save background)
  532.    */
  533.   KURL backgroundURL() const;
  534.  
  535.   /**
  536.    * Schedules a redirection after @p delay seconds.
  537.    */
  538.   void scheduleRedirection( int delay, const QString &url, bool lockHistory = true );
  539.  
  540.   /**
  541.    * Clears the widget and prepares it for new content.
  542.    *
  543.    * If you want url() to return
  544.    * for example "file:/tmp/test.html", you can use the following code:
  545.    * \code
  546.    * view->begin( KURL("file:/tmp/test.html" ) );
  547.    * \endcode
  548.    *
  549.    * @param url is the url of the document to be displayed.  Even if you
  550.    * are generating the HTML on the fly, it may be useful to specify
  551.    * a directory so that any pixmaps are found.
  552.    *
  553.    * @param xOffset is the initial horizontal scrollbar value. Usually
  554.    * you don't want to use this.
  555.    *
  556.    * @param yOffset is the initial vertical scrollbar value. Usually
  557.    * you don't want to use this.
  558.    *
  559.    * All child frames and the old document are removed if you call
  560.    * this method.
  561.    */
  562.   virtual void begin( const KURL &url = KURL(), int xOffset = 0, int yOffset = 0 );
  563.  
  564.   /**
  565.    * Writes another part of the HTML code to the widget.
  566.    *
  567.    * You may call
  568.    * this function many times in sequence. But remember: The fewer calls
  569.    * you make, the faster the widget will be.
  570.    *
  571.    * The HTML code is send through a decoder which decodes the stream to
  572.    * Unicode.
  573.    *
  574.    * The @p len parameter is needed for streams encoded in utf-16,
  575.    * since these can have \\0 chars in them. In case the encoding
  576.    * you're using isn't utf-16, you can safely leave out the length
  577.    * parameter.
  578.    *
  579.    * Attention: Don't mix calls to write( const char *) with calls
  580.    * to write( const QString & ).
  581.    *
  582.    * The result might not be what you want.
  583.    */
  584.   virtual void write( const char *str, int len = -1 );
  585.  
  586.   /**
  587.    * Writes another part of the HTML code to the widget.
  588.    *
  589.    * You may call
  590.    * this function many times in sequence. But remember: The fewer calls
  591.    * you make, the faster the widget will be.
  592.    */
  593.   virtual void write( const QString &str );
  594.  
  595.   /**
  596.    * Call this after your last call to write().
  597.    */
  598.   virtual void end();
  599.  
  600.   /*
  601.    * Prints the current HTML page laid out for the printer.
  602.    *
  603.    * (not implemented at the moment)
  604.    */
  605.   //    void print(QPainter *, int pageHeight, int pageWidth);
  606.  
  607.   /**
  608.    * Paints the HTML page to a QPainter. See KHTMLView::paint for details
  609.    */
  610.   void paint( QPainter *, const QRect &, int = 0, bool * = 0 );
  611.  
  612.   /**
  613.    * Sets the encoding the page uses.
  614.    *
  615.    * This can be different from the charset. The widget will try to reload the current page in the new
  616.    * encoding, if url() is not empty.
  617.    */
  618.   bool setEncoding( const QString &name, bool override = false );
  619.  
  620.   /**
  621.    * Returns the encoding the page currently uses.
  622.    *
  623.    * Note that the encoding might be different from the charset.
  624.    */
  625.   QString encoding() const;
  626.  
  627.   /**
  628.    * Sets a user defined style sheet to be used on top of the HTML 4
  629.    * default style sheet.
  630.    *
  631.    * This gives a wide range of possibilities to
  632.    * change the layout of the page.
  633.    *
  634.    * To have an effect this function has to be called after calling begin().
  635.    */
  636.   void setUserStyleSheet( const KURL &url );
  637.  
  638.   /**
  639.    * Sets a user defined style sheet to be used on top of the HTML 4
  640.    * default style sheet.
  641.    *
  642.    * This gives a wide range of possibilities to
  643.    * change the layout of the page.
  644.    *
  645.    * To have an effect this function has to be called after calling begin().
  646.    */
  647.   void setUserStyleSheet( const QString &styleSheet );
  648.  
  649. public:
  650.  
  651.   /**
  652.    * Sets the standard font style.
  653.    *
  654.    * @param name The font name to use for standard text.
  655.    */
  656.   void setStandardFont( const QString &name );
  657.  
  658.   /**
  659.    * Sets the fixed font style.
  660.    *
  661.    * @param name The font name to use for fixed text, e.g.
  662.    * the <tt><pre></tt> tag.
  663.    */
  664.   void setFixedFont( const QString &name );
  665.  
  666.   /**
  667.    * Finds the anchor named @p name.
  668.    *
  669.    * If the anchor is found, the widget
  670.    * scrolls to the closest position. Returns @p if the anchor has
  671.    * been found.
  672.    */
  673.   bool gotoAnchor( const QString &name );
  674.  
  675.   /**
  676.    * Go to the next anchor
  677.    *
  678.    * This is useful to navigate from outside the navigator
  679.    * @since 3.2
  680.    */
  681.   bool nextAnchor();
  682.  
  683.   /**
  684.    * Go to previous anchor
  685.    * @since 3.2
  686.    */
  687.   bool prevAnchor();
  688.  
  689.   /**
  690.    * Sets the cursor to use when the cursor is on a link.
  691.    */
  692.   void setURLCursor( const QCursor &c );
  693.  
  694.   /**
  695.    * Returns the cursor which is used when the cursor is on a link.
  696.    */
  697.   QCursor urlCursor() const;
  698.  
  699.   /**
  700.    * Extra Find options that can be used when calling the extended findText().
  701.    * @since 3.3
  702.    */
  703.   enum FindOptions
  704.   {
  705.       FindLinksOnly   = 1 * KFindDialog::MinimumUserOption,
  706.       FindNoPopups    = 2 * KFindDialog::MinimumUserOption
  707.       //FindIncremental = 4 * KFindDialog::MinimumUserOption
  708.   };
  709.  
  710.   /**
  711.    * Starts a new search by popping up a dialog asking the user what he wants to
  712.    * search for.
  713.    * @since 3.3
  714.    */
  715.   void findText();
  716.  
  717.   /**
  718.    * Starts a new search, but bypasses the user dialog.
  719.    * @param str The string to search for.
  720.    * @param options Find options.
  721.    * @param parent Parent used for centering popups like "string not found".
  722.    * @param findDialog Optionally, you can supply your own dialog.
  723.    * @since 3.3
  724.    */
  725.   void findText( const QString &str, long options, QWidget *parent = 0,
  726.                  KFindDialog *findDialog = 0 );
  727.  
  728.   /**
  729.    * Initiates a text search.
  730.    */
  731.   void findTextBegin();
  732.  
  733.   /**
  734.    * Finds the next occurrence of the string or expression.
  735.    * If isRegExp is true then str is converted to a QRegExp, and caseSensitive is ignored.
  736.    * @deprecated, use findText( str, options, parent, findDialog )
  737.    */
  738.   bool findTextNext( const QString &str, bool forward, bool caseSensitive, bool isRegExp );
  739.  
  740.   /**
  741.    * Finds the next occurence of a string set by @ref findText()
  742.    * @return true if a new match was found.
  743.    * @since 3.3
  744.    */
  745.   bool findTextNext();
  746.  
  747.   /**
  748.    * Finds the next occurence of a string set by @ref findText()
  749.    * @param reverse if true, revert seach direction (only if no find dialog is used)
  750.    * @return true if a new match was found.
  751.    * @since 3.5
  752.    */
  753.   // KDE4 merge with default = false
  754.   bool findTextNext( bool reverse );
  755.  
  756.   /**
  757.    * Sets the Zoom factor. The value is given in percent, larger values mean a
  758.    * generally larger font and larger page contents. It is not guaranteed that
  759.    * all parts of the page are scaled with the same factor though.
  760.    *
  761.    * The given value should be in the range of 20..300, values outside that
  762.    * range are not guaranteed to work. A value of 100 will disable all zooming
  763.    * and show the page with the sizes determined via the given lengths in the
  764.    * stylesheets.
  765.    */
  766.   void setZoomFactor(int percent);
  767.  
  768.   /**
  769.    * Returns the current zoom factor.
  770.    */
  771.   int zoomFactor() const;
  772.  
  773.   /**
  774.    * Returns the text the user has marked.
  775.    */
  776.   virtual QString selectedText() const;
  777.  
  778.   /**
  779.    * Return the text the user has marked.  This is guaranteed to be valid xml,
  780.    * and to contain the \<html> and \<body> tags.
  781.    *
  782.    * FIXME probably should make virtual for 4.0 ?
  783.    *
  784.    * @since 3.4
  785.    */
  786.   QString selectedTextAsHTML() const;
  787.  
  788.   /**
  789.    * Returns the selected part of the HTML.
  790.    */
  791.   DOM::Range selection() const;
  792.  
  793.   /**
  794.    * Returns the selected part of the HTML by returning the starting and end
  795.    * position.
  796.    *
  797.    * If there is no selection, both nodes and offsets are equal.
  798.    * @param startNode returns node selection starts in
  799.    * @param startOffset returns offset within starting node
  800.    * @param endNode returns node selection ends in
  801.    * @param endOffset returns offset within end node.
  802.    * @since 3.2
  803.    */
  804.   void selection(DOM::Node &startNode, long &startOffset,
  805.           DOM::Node &endNode, long &endOffset) const;
  806.  
  807.   /**
  808.    * Sets the current selection.
  809.    */
  810.   void setSelection( const DOM::Range & );
  811.  
  812.   /**
  813.    * Has the user selected anything?
  814.    *
  815.    *  Call selectedText() to
  816.    * retrieve the selected text.
  817.    *
  818.    * @return @p true if there is text selected.
  819.    */
  820.   bool hasSelection() const;
  821.  
  822.   /**
  823.    * Marks all text in the document as selected.
  824.    */
  825.   void selectAll();
  826.  
  827.   /**
  828.    * Convenience method to show the document's view.
  829.    *
  830.    * Equivalent to widget()->show() or view()->show() .
  831.    */
  832.   void show();
  833.  
  834.   /**
  835.    * Convenience method to hide the document's view.
  836.    *
  837.    * Equivalent to widget()->hide() or view()->hide().
  838.    */
  839.   void hide();
  840.  
  841.   /**
  842.    * Returns a reference to the partmanager instance which
  843.    * manages html frame objects.
  844.    */
  845.   KParts::PartManager *partManager();
  846.  
  847.   /**
  848.    * Saves the KHTMLPart's complete state (including child frame
  849.    * objects) to the provided QDataStream.
  850.    *
  851.    * This is called from the saveState() method of the
  852.    * browserExtension().
  853.    */
  854.   virtual void saveState( QDataStream &stream );
  855.   /**
  856.    * Restores the KHTMLPart's previously saved state (including
  857.    * child frame objects) from the provided QDataStream.
  858.    *
  859.    * @see saveState()
  860.    *
  861.    * This is called from the restoreState() method of the
  862.    * browserExtension() .
  863.    **/
  864.   virtual void restoreState( QDataStream &stream );
  865.  
  866.   /**
  867.    * Returns the @p Node currently under the mouse.
  868.    *
  869.    * The returned node may be a shared node (e. g. an \<area> node if the
  870.    * mouse is hovering over an image map).
  871.    */
  872.   DOM::Node nodeUnderMouse() const;
  873.  
  874.   /**
  875.    * Returns the @p Node currently under the mouse that is not shared.
  876.    *
  877.    * The returned node is always the node that is physically under the mouse
  878.    * pointer (irrespective of logically overlying elements like, e. g.,
  879.    * \<area> on image maps).
  880.    * @since 3.3
  881.    */
  882.   DOM::Node nonSharedNodeUnderMouse() const;
  883.  
  884.   /**
  885.    * @internal
  886.    */
  887.   const KHTMLSettings *settings() const;
  888.  
  889.   /**
  890.    * Returns a pointer to the parent KHTMLPart if the part is a frame
  891.    * in an HTML frameset.
  892.    *
  893.    *  Returns 0L otherwise.
  894.    */
  895.   KHTMLPart *parentPart();
  896.  
  897.   /**
  898.    * Returns a list of names of all frame (including iframe) objects of
  899.    * the current document. Note that this method is not working recursively
  900.    * for sub-frames.
  901.    */
  902.   QStringList frameNames() const;
  903.  
  904.   QPtrList<KParts::ReadOnlyPart> frames() const;
  905.  
  906.   /**
  907.    * Finds a frame by name. Returns 0L if frame can't be found.
  908.    */
  909.   KHTMLPart *findFrame( const QString &f );
  910.  
  911.   /**
  912.    * Recursively finds the part containing the frame with name @p f
  913.    * and checks if it is accessible by @p callingPart
  914.    * Returns 0L if no suitable frame can't be found.
  915.    * Returns parent part if a suitable frame was found and
  916.    * frame info in @p *childFrame
  917.    * @since 3.3
  918.    */
  919.   KHTMLPart *findFrameParent( KParts::ReadOnlyPart *callingPart, const QString &f, khtml::ChildFrame **childFrame=0 );
  920.  
  921.   /**
  922.    * Return the current frame (the one that has focus)
  923.    * Not necessarily a direct child of ours, framesets can be nested.
  924.    * Returns "this" if this part isn't a frameset.
  925.    */
  926.   KParts::ReadOnlyPart *currentFrame() const;
  927.  
  928.   /**
  929.    * Returns whether a frame with the specified name is exists or not.
  930.    * In contrary to the findFrame method this one also returns true
  931.    * if the frame is defined but no displaying component has been
  932.    * found/loaded, yet.
  933.    */
  934.   bool frameExists( const QString &frameName );
  935.  
  936.   /**
  937.    * Returns child frame framePart its script interpreter
  938.    */
  939.   KJSProxy *framejScript(KParts::ReadOnlyPart *framePart);
  940.  
  941.   /**
  942.    * Finds a frame by name. Returns 0L if frame can't be found.
  943.    */
  944.   KParts::ReadOnlyPart *findFramePart( const QString &f );
  945.   /**
  946.    * Called by KJS.
  947.    * Sets the StatusBarText assigned
  948.    * via window.status
  949.    */
  950.   void setJSStatusBarText( const QString &text );
  951.  
  952.   /**
  953.    * Called by KJS.
  954.    * Sets the DefaultStatusBarText assigned
  955.    * via window.defaultStatus
  956.    */
  957.   void setJSDefaultStatusBarText( const QString &text );
  958.  
  959.   /**
  960.    * Called by KJS.
  961.    * Returns the StatusBarText assigned
  962.    * via window.status
  963.    */
  964.   QString jsStatusBarText() const;
  965.  
  966.   /**
  967.    * Called by KJS.
  968.    * Returns the DefaultStatusBarText assigned
  969.    * via window.defaultStatus
  970.    */
  971.   QString jsDefaultStatusBarText() const;
  972.  
  973.   /**
  974.    * Referrer used for links in this page.
  975.    */
  976.   QString referrer() const;
  977.  
  978.   /**
  979.    * Referrer used to obtain this page.
  980.    */
  981.   QString pageReferrer() const;
  982.  
  983.   /**
  984.    * Last-modified date (in raw string format), if received in the [HTTP] headers.
  985.    */
  986.   QString lastModified() const;
  987.  
  988.   /**
  989.    * Loads a style sheet into the stylesheet cache.
  990.    */
  991.   void preloadStyleSheet( const QString &url, const QString &stylesheet );
  992.  
  993.   /**
  994.    * Loads a script into the script cache.
  995.    */
  996.   void preloadScript( const QString &url, const QString &script );
  997.  
  998.   /**
  999.    * @internal
  1000.    */
  1001.   bool restored() const;
  1002.  
  1003.   // ### KDE4 remove me
  1004.   enum FormNotification { NoNotification = 0, Before, Only, Unused=255 };
  1005.   /**
  1006.    * Determine if signal should be emitted before, instead or never when a
  1007.    * submitForm() happens.
  1008.    * @since 3.2
  1009.    * ### KDE4 remove me
  1010.    */
  1011.   void setFormNotification(FormNotification fn);
  1012.  
  1013.   /**
  1014.    * Determine if signal should be emitted before, instead or never when a
  1015.    * submitForm() happens.
  1016.    * ### KDE4 remove me
  1017.    * @since 3.2
  1018.    */
  1019.   FormNotification formNotification() const;
  1020.  
  1021.   /**
  1022.    * Returns the toplevel (origin) URL of this document, even if this
  1023.    * part is a frame or an iframe.
  1024.    *
  1025.    * @return the actual original url.
  1026.    * @since 3.2
  1027.    */
  1028.   KURL toplevelURL();
  1029.  
  1030.   /**
  1031.    * Checks whether the page contains unsubmitted form changes.
  1032.    *
  1033.    * @return true if form changes exist
  1034.    * @since 3.3
  1035.    */
  1036.   bool isModified() const;
  1037.  
  1038.   /**
  1039.    * Shows or hides the suppressed popup indicator
  1040.    * @deprecated
  1041.    * @since 3.4
  1042.    */
  1043.   void setSuppressedPopupIndicator( bool enable );
  1044.  
  1045.   /**
  1046.    * Shows or hides the suppressed popup indicator
  1047.    * @since 3.5
  1048.    */
  1049.   void setSuppressedPopupIndicator( bool enable, KHTMLPart *originPart );
  1050.  
  1051.   /**
  1052.    * @internal
  1053.    * @since 3.5
  1054.    */
  1055.   bool inProgress() const;
  1056.  
  1057. signals:
  1058.   /**
  1059.    * Emitted if the cursor is moved over an URL.
  1060.    */
  1061.   void onURL( const QString &url );
  1062.  
  1063.   /**
  1064.    * Emitted when the user clicks the right mouse button on the document.
  1065.    */
  1066.   void popupMenu( const QString &url, const QPoint &point );
  1067.  
  1068.   /**
  1069.    * This signal is emitted when the selection changes.
  1070.    */
  1071.   void selectionChanged();
  1072.  
  1073.   /**
  1074.    * This signal is emitted when an element retrieves the
  1075.    * keyboard focus. Note that the signal argument can be
  1076.    * a null node if no element is active, meaning a node
  1077.    * has explicitly been deactivated without a new one
  1078.    * becoming active.
  1079.    */
  1080.   void nodeActivated( const DOM::Node & );
  1081.  
  1082.   /**
  1083.    * @internal */
  1084.   void docCreated();
  1085.  
  1086.   /**
  1087.    * This signal is emitted whenever the caret position has been changed.
  1088.    *
  1089.    * The signal transmits the position the DOM::Range way, the node and
  1090.    * the zero-based offset within this node.
  1091.    * @param node node which the caret is in. This can be null if the caret
  1092.    *    has been deactivated.
  1093.    * @param offset offset within the node. If the node is null, the offset
  1094.    *    is meaningless.
  1095.    * @since 3.2
  1096.    */
  1097.   void caretPositionChanged(const DOM::Node &node, long offset);
  1098.  
  1099.  
  1100.   /**
  1101.    * If form notification is on, this will be emitted either for a form
  1102.    * submit or before the form submit according to the setting.
  1103.    * @since 3.2
  1104.    * ### KDE4 remove me
  1105.    */
  1106.   void formSubmitNotification(const char *action, const QString& url,
  1107.                   const QByteArray& formData, const QString& target,
  1108.                   const QString& contentType, const QString& boundary);
  1109.  
  1110.  
  1111. protected:
  1112.  
  1113.   /**
  1114.    * returns a KURL object for the given url. Use when
  1115.    * you know what you're doing.
  1116.    */
  1117.   KURL completeURL( const QString &url );
  1118.  
  1119.   /**
  1120.    * presents a detailed error message to the user.
  1121.    * @p errorCode kio error code, eg KIO::ERR_SERVER_TIMEOUT.
  1122.    * @p text kio additional information text.
  1123.    * @p url the url that triggered the error.
  1124.    */
  1125.   void htmlError( int errorCode, const QString& text, const KURL& reqUrl );
  1126.  
  1127.   virtual void customEvent( QCustomEvent *event );
  1128.  
  1129.   /**
  1130.    * Eventhandler of the khtml::MousePressEvent.
  1131.    */
  1132.   virtual void khtmlMousePressEvent( khtml::MousePressEvent *event );
  1133.   /**
  1134.    * Eventhandler for the khtml::MouseDoubleClickEvent.
  1135.    */
  1136.   virtual void khtmlMouseDoubleClickEvent( khtml::MouseDoubleClickEvent * );
  1137.   /**
  1138.    * Eventhandler for the khtml::MouseMouseMoveEvent.
  1139.    */
  1140.   virtual void khtmlMouseMoveEvent( khtml::MouseMoveEvent *event );
  1141.   /**
  1142.    * Eventhandler for the khtml::MouseMouseReleaseEvent.
  1143.    */
  1144.   virtual void khtmlMouseReleaseEvent( khtml::MouseReleaseEvent *event );
  1145.   /**
  1146.    * Eventhandler for the khtml::DrawContentsEvent.
  1147.    */
  1148.   virtual void khtmlDrawContentsEvent( khtml::DrawContentsEvent * );
  1149.  
  1150.   /**
  1151.    * Internal reimplementation of KParts::Part::guiActivateEvent .
  1152.    */
  1153.   virtual void guiActivateEvent( KParts::GUIActivateEvent *event );
  1154.  
  1155.   /**
  1156.    * Internal empty reimplementation of KParts::ReadOnlyPart::openFile .
  1157.    */
  1158.   virtual bool openFile();
  1159.  
  1160.   virtual void urlSelected( const QString &url, int button, int state,
  1161.                             const QString &_target, KParts::URLArgs args = KParts::URLArgs());
  1162.  
  1163.   /**
  1164.    * This method is called when a new embedded object (include html frames) is to be created.
  1165.    * Reimplement it if you want to add support for certain embeddable objects without registering
  1166.    * them in the KDE wide registry system (KSyCoCa) . Another reason for re-implementing this
  1167.    * method could be if you want to derive from KTHMLPart and also want all html frame objects
  1168.    * to be a object of your derived type, in which case you should return a new instance for
  1169.    * the mimetype 'text/html' .
  1170.    */
  1171.   virtual KParts::ReadOnlyPart *createPart( QWidget *parentWidget, const char *widgetName,
  1172.                                             QObject *parent, const char *name,
  1173.                                             const QString &mimetype, QString &serviceName,
  1174.                                             QStringList &serviceTypes, const QStringList ¶ms);
  1175.  
  1176.   // This is for RenderPartObject. We want to ask the 'download plugin?'
  1177.   // question only once per mimetype
  1178.   bool pluginPageQuestionAsked( const QString& mimetype ) const;
  1179.   void setPluginPageQuestionAsked( const QString& mimetype );
  1180.  
  1181.   enum PageSecurity { NotCrypted, Encrypted, Mixed };
  1182.   void setPageSecurity( PageSecurity sec );
  1183.  
  1184.   /**
  1185.    * Implements the streaming API of KParts::ReadOnlyPart.
  1186.    */
  1187.   virtual bool doOpenStream( const QString& mimeType );
  1188.  
  1189.   /**
  1190.    * Implements the streaming API of KParts::ReadOnlyPart.
  1191.    */
  1192.   virtual bool doWriteStream( const QByteArray& data );
  1193.  
  1194.   /**
  1195.    * Implements the streaming API of KParts::ReadOnlyPart.
  1196.    */
  1197.   virtual bool doCloseStream();
  1198.  
  1199. public slots:
  1200.  
  1201.   /**
  1202.    * Sets the focused node of the document to the specified node. If the node is a form control, the control will
  1203.    * receive focus in the same way that it would if the user had clicked on it or tabbed to it with the keyboard. For
  1204.    * most other types of elements, there is no visual indication of whether or not they are focused.
  1205.    *
  1206.    * See activeNode
  1207.    *
  1208.    * @param node The node to focus
  1209.    */
  1210.   void setActiveNode( const DOM::Node &node );
  1211.  
  1212.   /**
  1213.    * Stops all animated images on the current and child pages
  1214.    */
  1215.   void stopAnimations();
  1216.  
  1217.   QCString dcopObjectId() const;
  1218.  
  1219.   /**
  1220.    * Execute the specified snippet of JavaScript code.
  1221.    *
  1222.    * Returns @p true if JavaScript was enabled, no error occurred
  1223.    * and the code returned true itself or @p false otherwise.
  1224.    * @deprecated, use executeString( DOM::Node(), script)
  1225.    */
  1226.   QVariant executeScript( const QString &script );
  1227.  
  1228.   /**
  1229.    * Enables/disables caret mode.
  1230.    *
  1231.    * Enabling caret mode displays a caret which can be used to navigate
  1232.    * the document using the keyboard only. Caret mode is switched off by
  1233.    * default.
  1234.    *
  1235.    * @param enable @p true to enable, @p false to disable caret mode.
  1236.    * @since 3.2
  1237.    */
  1238.   void setCaretMode(bool enable);
  1239.  
  1240.   /**
  1241.    * Makes the document editable.
  1242.    *
  1243.    * Setting this property to @p true makes the document, and its
  1244.    * subdocuments (such as frames, iframes, objects) editable as a whole.
  1245.    * FIXME: insert more information about navigation, features etc. as seen fit
  1246.    *
  1247.    * @param enable @p true to set document editable, @p false to set it
  1248.    *    read-only.
  1249.    * @since 3.2 (pending, do not use)
  1250.    */
  1251.   void setEditable(bool enable);
  1252.  
  1253.   /**
  1254.    * Sets the visibility of the caret.
  1255.    *
  1256.    * This methods displays or hides the caret regardless of the current
  1257.    * caret display policy (see setCaretDisplayNonFocused), and regardless
  1258.    * of focus.
  1259.    *
  1260.    * The caret will be shown/hidden only under at least one of
  1261.    * the following conditions:
  1262.    * @li the document is editable
  1263.    * @li the document is in caret mode
  1264.    * @li the document's currently focused element is editable
  1265.    *
  1266.    * @param show @p true to make visible, @p false to hide.
  1267.    * @since 3.2
  1268.    */
  1269.   void setCaretVisible(bool show);
  1270.  
  1271.   // ### KDE4 FIXME:
  1272.   //          Remove this and make the one below protected+virtual slot.
  1273.   //          Warning: this is effectively "internal".  Be careful.
  1274.   // @since 3.2
  1275.   void submitFormProxy( const char *action, const QString &url,
  1276.                         const QByteArray &formData,
  1277.                         const QString &target,
  1278.                         const QString& contentType = QString::null,
  1279.                         const QString& boundary = QString::null );
  1280.  
  1281. private slots:
  1282.  
  1283.   /**
  1284.    * @internal
  1285.    */
  1286.   void reparseConfiguration();
  1287.  
  1288.   /**
  1289.    * @internal
  1290.    */
  1291.   void slotData( KIO::Job*, const QByteArray &data );
  1292.   /**
  1293.   * @internal
  1294.   */
  1295.   void slotInfoMessage( KIO::Job*, const QString& msg );
  1296.   /**
  1297.    * @internal
  1298.    */
  1299.   void slotRestoreData( const QByteArray &data );
  1300.   /**
  1301.    * @internal
  1302.    */
  1303.   void slotFinished( KIO::Job* );
  1304.   /**
  1305.    * @internal
  1306.    */
  1307.   void slotFinishedParsing();
  1308.   /**
  1309.    * @internal
  1310.    */
  1311.   void slotRedirect();
  1312.   /**
  1313.    * @internal
  1314.    */
  1315.   void slotRedirection( KIO::Job*, const KURL& );
  1316.   /**
  1317.    * @internal
  1318.    */
  1319.   void slotDebugScript();
  1320.   /**
  1321.    * @internal
  1322.    */
  1323.   void slotDebugDOMTree();
  1324.   /**
  1325.    * @internal
  1326.    */
  1327.   void slotDebugRenderTree();
  1328.   /**
  1329.    * @internal
  1330.    */
  1331.   void slotStopAnimations();
  1332.   /**
  1333.    * @internal
  1334.    */
  1335.   virtual void slotViewDocumentSource();
  1336.   /**
  1337.    * @internal
  1338.    */
  1339.   virtual void slotViewFrameSource();
  1340.   /**
  1341.    * @internal
  1342.    */
  1343.   void slotViewPageInfo();
  1344.   /**
  1345.    * @internal
  1346.    */
  1347.   virtual void slotSaveBackground();
  1348.   /**
  1349.    * @internal
  1350.    */
  1351.   virtual void slotSaveDocument();
  1352.   /**
  1353.    * @internal
  1354.    */
  1355.   virtual void slotSaveFrame();
  1356.   /**
  1357.    * @internal
  1358.    */
  1359.   virtual void slotSecurity();
  1360.   /**
  1361.    * @internal
  1362.    */
  1363.   virtual void slotSetEncoding();
  1364.  
  1365.   /**
  1366.    * @internal
  1367.    */
  1368.   virtual void slotUseStylesheet();
  1369.  
  1370.   virtual void slotFind();
  1371.   virtual void slotFindDone(); // ### remove me
  1372.   virtual void slotFindDialogDestroyed();
  1373.   void slotFindNext();
  1374.   void slotFindPrev();
  1375.   void slotFindAheadText();
  1376.   void slotFindAheadLink();
  1377.  
  1378.   void slotIncZoom();
  1379.   void slotDecZoom();
  1380.   void slotIncZoomFast();
  1381.   void slotDecZoomFast();
  1382.  
  1383.   void slotLoadImages();
  1384.   void slotWalletClosed();
  1385.   void launchWalletManager();
  1386.   void walletMenu();
  1387.  
  1388.   /**
  1389.    * @internal
  1390.    */
  1391.   void submitFormAgain();
  1392.  
  1393.   /**
  1394.    * @internal
  1395.    */
  1396.   void updateActions();
  1397.   /**
  1398.    * @internal
  1399.    */
  1400.   void slotPartRemoved( KParts::Part *part );
  1401.   /**
  1402.    * @internal
  1403.    */
  1404.   void slotActiveFrameChanged( KParts::Part *part );
  1405.   /**
  1406.    * @internal
  1407.    */
  1408.   void slotChildStarted( KIO::Job *job );
  1409.   /**
  1410.    * @internal
  1411.    */
  1412.   void slotChildCompleted();
  1413.   /**
  1414.    * @internal
  1415.    */
  1416.   void slotChildCompleted( bool );
  1417.   /**
  1418.    * @internal
  1419.    */
  1420.   void slotParentCompleted();
  1421.   /**
  1422.    * @internal
  1423.    */
  1424.   void slotChildURLRequest( const KURL &url, const KParts::URLArgs &args );
  1425.   /**
  1426.    * @internal
  1427.    */
  1428.   void slotChildDocCreated();
  1429.   /**
  1430.    * @internal
  1431.    */
  1432.   void slotRequestFocus( KParts::ReadOnlyPart * );
  1433.   void slotLoaderRequestStarted( khtml::DocLoader*, khtml::CachedObject* obj);
  1434.   void slotLoaderRequestDone( khtml::DocLoader*, khtml::CachedObject *obj );
  1435.   void checkCompleted();
  1436.  
  1437.   /**
  1438.    * @internal
  1439.    */
  1440.   void slotAutoScroll();
  1441.  
  1442.   void slotPrintFrame();
  1443.  
  1444.   void slotSelectAll();
  1445.  
  1446.   /**
  1447.    * @internal
  1448.    */
  1449.   void slotProgressUpdate();
  1450.  
  1451.   /*
  1452.    * @internal
  1453.    */
  1454.   void slotJobPercent( KIO::Job*, unsigned long );
  1455.  
  1456.   /*
  1457.    * @internal
  1458.    */
  1459.   void slotJobDone( KIO::Job* );
  1460.  
  1461.   /*
  1462.    * @internal
  1463.    */
  1464.   void slotUserSheetStatDone( KIO::Job* );
  1465.  
  1466.   /*
  1467.    * @internal
  1468.    */
  1469.   void slotJobSpeed( KIO::Job*, unsigned long );
  1470.  
  1471.   /**
  1472.    * @internal
  1473.    */
  1474.   void slotClearSelection();
  1475.  
  1476.   /**
  1477.    * @internal
  1478.    */
  1479.   void slotZoomView( int );
  1480.  
  1481.   /**
  1482.    * @internal
  1483.    */
  1484.   void slotHighlight( const QString &, int index, int length );
  1485.  
  1486.   /**
  1487.    * @internal
  1488.    */
  1489.   void slotAutomaticDetectionLanguage( int _id );
  1490.  
  1491.   /**
  1492.    * @internal
  1493.    */
  1494.   void slotToggleCaretMode();
  1495.  
  1496.   /**
  1497.    * @internal
  1498.    */
  1499.   void suppressedPopupMenu();
  1500.  
  1501.   /**
  1502.    * @internal
  1503.    */
  1504.   void togglePopupPassivePopup();
  1505.  
  1506.   /**
  1507.    * @internal
  1508.    */
  1509.   void showSuppressedPopups();
  1510.  
  1511.   /**
  1512.    * @internal
  1513.    */
  1514.   void launchJSConfigDialog();
  1515.  
  1516.   /**
  1517.    * @internal
  1518.    */
  1519.   void launchJSErrorDialog();
  1520.  
  1521.   /**
  1522.    * @internal
  1523.    */
  1524.   void removeJSErrorExtension();
  1525.  
  1526.   /**
  1527.    * @internal
  1528.    */
  1529.   void disableJSErrorExtension();
  1530.  
  1531.   /**
  1532.    * @internal
  1533.    */
  1534.   void jsErrorDialogContextMenu();
  1535.  
  1536.   /**
  1537.    * @internal
  1538.    * used to restore or reset the view's scroll position (including positioning on anchors)
  1539.    * once a sufficient portion of the document as been laid out.
  1540.    */
  1541.   void restoreScrollPosition();
  1542.  
  1543.   void walletOpened(KWallet::Wallet*);
  1544.  
  1545. private:
  1546.  
  1547.   KJSErrorDlg *jsErrorExtension();
  1548.  
  1549.   enum StatusBarPriority { BarDefaultText, BarHoverText, BarOverrideText };
  1550.   void setStatusBarText( const QString& text, StatusBarPriority p);
  1551.  
  1552.   bool restoreURL( const KURL &url );
  1553.   void resetFromScript();
  1554.   void emitSelectionChanged();
  1555.   // Returns whether callingHtmlPart may access this part
  1556.   bool checkFrameAccess(KHTMLPart *callingHtmlPart);
  1557.   bool openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs );
  1558.   bool urlSelectedIntern( const QString &url, int button, int state,
  1559.                           const QString &_target, KParts::URLArgs args = KParts::URLArgs());
  1560.   void startAutoScroll();
  1561.   void stopAutoScroll();
  1562.   void overURL( const QString &url, const QString &target, bool shiftPressed = false );
  1563.   void resetHoverText(); // Undo overURL and reset HoverText
  1564.  
  1565.   bool processObjectRequest( khtml::ChildFrame *child, const KURL &url, const QString &mimetype );
  1566.  
  1567.   KWallet::Wallet* wallet();
  1568.  
  1569.   void openWallet(DOM::HTMLFormElementImpl*);
  1570.   void saveToWallet(const QString& key, const QMap<QString,QString>& data);
  1571.   void dequeueWallet(DOM::HTMLFormElementImpl*);
  1572.   
  1573.   void enableFindAheadActions(bool);
  1574.  
  1575.   /**
  1576.    * @internal
  1577.    */
  1578.   // ### KDE4 FIXME:
  1579.   //          It is desirable to be able to filter form submissions as well.
  1580.   //          For instance, forms can have a target and an inheriting class
  1581.   //          might want to filter based on the target.  Make this protected
  1582.   //          and virtual, or provide a better solution.
  1583.   //          See the web_module for the sidebar for an example where this is
  1584.   //          necessary.
  1585.   void submitForm( const char *action, const QString &url, const QByteArray &formData,
  1586.                    const QString &target, const QString& contentType = QString::null,
  1587.                    const QString& boundary = QString::null );
  1588.  
  1589.   void popupMenu( const QString &url );
  1590.  
  1591.   void init( KHTMLView *view, GUIProfile prof );
  1592.  
  1593.  
  1594.   void clear();
  1595.  
  1596.   bool scheduleScript( const DOM::Node &n, const QString& script);
  1597.  
  1598.   QVariant crossFrameExecuteScript(const QString& target, const QString& script);
  1599.   QVariant executeScheduledScript();
  1600.  
  1601.   bool requestFrame( khtml::RenderPart *frame, const QString &url, const QString &frameName,
  1602.                      const QStringList &args = QStringList(), bool isIFrame = false );
  1603.  
  1604.   /**
  1605.    * @internal returns a name for a frame without a name.
  1606.    * This function returns a sequence of names.
  1607.    * All names in a sequence are different but the sequence is
  1608.    * always the same.
  1609.    * The sequence is reset in clear().
  1610.    */
  1611.   QString requestFrameName();
  1612.  
  1613.   bool requestObject( khtml::RenderPart *frame, const QString &url, const QString &serviceType,
  1614.                       const QStringList &args = QStringList() );
  1615.  
  1616.   bool requestObject( khtml::ChildFrame *child, const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
  1617.  
  1618.   DOM::EventListener *createHTMLEventListener( QString code, QString name, DOM::NodeImpl *node );
  1619.  
  1620.   DOM::HTMLDocumentImpl *docImpl() const;
  1621.   DOM::DocumentImpl *xmlDocImpl() const;
  1622.   khtml::ChildFrame *frame( const QObject *obj );
  1623.  
  1624.   khtml::ChildFrame *recursiveFrameRequest( KHTMLPart *callingHtmlPart, const KURL &url, const KParts::URLArgs &args, bool callParent = true );
  1625.  
  1626.   bool checkLinkSecurity( const KURL &linkURL,const QString &message = QString::null, const QString &button = QString::null );
  1627.   QVariant executeScript( const QString& filename, int baseLine, const DOM::Node &n, const QString& script );
  1628.  
  1629.   KJSProxy *jScript();
  1630.  
  1631.   KHTMLPart *opener();
  1632.   long cacheId() const;
  1633.   void setOpener( KHTMLPart *_opener );
  1634.   bool openedByJS();
  1635.   void setOpenedByJS( bool _openedByJS );
  1636.  
  1637.   void checkEmitLoadEvent();
  1638.   void emitLoadEvent();
  1639.  
  1640.   bool initFindNode( bool selection, bool reverse, bool fromCursor );
  1641.  
  1642.   void extendSelection( DOM::NodeImpl* node, long offset, DOM::Node& selectionNode, long& selectionOffset, bool right, bool paragraph );
  1643.   /** extends the current selection to the given content-coordinates @p x, @p y
  1644.    * @param x content x-coordinate
  1645.    * @param y content y-coordinate
  1646.    * @param absX absolute x-coordinate of @p innerNode
  1647.    * @param absY absolute y-coordinate of @p innerNode
  1648.    * @param innerNode node from which to start extending the selection. The
  1649.    *    caller has to ensure that the node has a renderer.
  1650.    * @internal
  1651.    */
  1652.   void extendSelectionTo(int x, int y, int absX, int absY, const DOM::Node &innerNode);
  1653.   /** checks whether a selection is extended.
  1654.    * @return @p true if a selection is extended by the mouse.
  1655.    */
  1656.   bool isExtendingSelection() const;
  1657.   khtml::Decoder *createDecoder();
  1658.   QString defaultEncoding() const;
  1659.  
  1660.   /** .html, .xhtml or .xml */
  1661.   QString defaultExtension() const;
  1662.  
  1663.   /** @internal
  1664.    * generic zoom in
  1665.    */
  1666.   void zoomIn(const int stepping[], int count);
  1667.   /** @internal
  1668.    * generic zoom out
  1669.    */
  1670.   void zoomOut(const int stepping[], int count);
  1671.  
  1672.   void emitCaretPositionChanged(const DOM::Node &node, long offset);
  1673.  
  1674.   void setDebugScript( bool enable );
  1675.  
  1676.   void runAdFilter();
  1677.  
  1678.   KHTMLPartPrivate *d;
  1679.   friend class KHTMLPartPrivate;
  1680. };
  1681.  
  1682.  
  1683. #endif
  1684.